package com.demo.transaction.trance;

import com.demo.transaction.mapper.UserMapper;
import lombok.SneakyThrows;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executors;

/**
 * @Author: lkz
 * @Title: TestTrance
 * @Description: TODO
 * @Date: 2023/9/22 10:07
 */

public class TestTrance {



    @Resource
    private MultiplyThreadTransactionManager multiplyThreadTransactionManager;


    public void test(){
        List<Runnable> tasks=new ArrayList<>();

        tasks.add(()->{
            System.out.println("执行业务逻辑-----");
            throw new RuntimeException("我就要抛出异常!");
        });

        tasks.add(()->{

            System.out.println("执行业务逻辑----5655-");
        });

        multiplyThreadTransactionManager.runAsyncButWaitUntilAllDown(tasks, Executors.newCachedThreadPool());
    }


}
